/*****************************************************************************
*                               Securiplex Inc.                              *
*                                                                            *
******************************************************************************
*                                                                            *
*                                                                            *
*            ###   #     #  #####  #       #     # ######  #######           *
*             #    ##    # #     # #       #     # #     # #                 *
*             #    # #   # #       #       #     # #     # #                 *
*             #    #  #  # #       #       #     # #     # #####             *
*             #    #   # # #       #       #     # #     # #                 *
*             #    #    ## #     # #       #     # #     # #                 *
*            ###   #     #  #####  #######  #####  ######  #######           *
*                                                                            *
*                                                                            *
*            #####  #     # #     # ######  ####### #        #####           *
*           #     #  #   #  ##   ## #     # #     # #       #     #          *
*           #         # #   # # # # #     # #     # #       #                *
*            #####     #    #  #  # ######  #     # #        #####           *
*                 #    #    #     # #     # #     # #             #          *
*           #     #    #    #     # #     # #     # #       #     #          *
*            #####     #    #     # ######  ####### #######  #####           *
*                                                                            *
*                                                                            *
******************************************************************************
*
*            Title: PROPAK CODE Include File for General Alarm Module
*      Part Number: si-03668-09
*        $Revision: 1.1 $
*            $Date: 2003/02/06 09:35:03 $
*          $Source: /spx1/sw/TRE-16577-00/MEM-16245-00/src/mod_03668/si_03668.h,v $
*
******************************************************************************
*                                                                            *
*                             PROPRIETARY LEGEND                             *
*                                                                            *
*            (C) Copyright Securiplex Inc, 2003, All Rights Reserved.        *
*                                                                            *
*      The information contained herein or herewith is the  confidential     *
*      and proprietary property of Securiplex Inc. The information shall     *
*      not, in whole or in part, be  reproduced,  copied,  disclosed  or     *
*      used  other than as expressly authorized by written permission of     *
*      Securiplex Inc.  The copyright and the foregoing  restriction  on     *
*      reproduction, copy, disclosure and use extend to all the media in     *
*      which this information may be  embodied,  including  magnetic  or     *
*      electronic  storage,  punch card, paper tape, computer print-out,     *
*      visual display, etc.                                                  *
*                                                                            *
******************************************************************************

******************************************************************************
*                   R E V I S I O N      H I S T O R Y                       *
******************************************************************************
* $Log:	si_03668.h,v $
 * Revision 1.1  2003/02/06  09:35:03  09:35:03  patrickt (Patrick Therien)
 * Initial revision
 *
******************************************************************************

******************************************************************************
*                      I N C L U D E       F I L E S
*****************************************************************************/

#ifndef GA_H_
#define GA_H_

#include "DataType.h"

enum eGA_newAlm {
	NOT_NEW=0,
	NEW_ALM=1
};
enum eGA_Status {
	GA_inActive = 0,
	GA_Active = 1
};
enum eGA_OutputStatus {
	GA_STATUS_OFF = 0,
	GA_STATUS_ON = 1
};
enum eGA_cfgSilenceInAlert {
	silenceInAlertEnabled = 1, // bit 0
	silenceInAlertDisabled = 0 // bit 0
};
enum eGA_silence {
	NOT_SILENCED = 0,
	SILENCED = 1
};
enum eGA_AlertOnOff {
	GA_ALERT_OFF = 0,
	GA_ALERT_ON = 1
};
enum eGA_States {
	GA_NORMAL = 0,
	GA_PRE_ALERT = 1,
	GA_ALERT = 2,
	GA_EVAC_INHIBIT_SILENCE = 3,
	GA_EVAC_AUTO_SILENCE = 4,
	GA_EVAC = 5,
	GA_StateCount
};
enum eGA_skipToEvac {
	DO_NOT_SKIP_EVAC = 0,
	SKIP_EVAC = 1
};
void GA_init(void);
void GA_notifyGA_SIalm(unsigned char inputMask, enum eGA_skipToEvac evac);
void GA_clearGA_SIalm(unsigned char inputMask);
BYTE GA_getGA_SIalm(void);

enum eGA_silence GA_getIsSilenced(void);
enum eGA_OutputStatus GA_statusForSOSZ(void);
enum eGA_States GA_getState(void);
enum eGA_AlertOnOff GA_getAlertOnOff(void);

void GA_thread(void);


extern const struct configMemRAM_t * pConfigMemRAM;


#if 0

/* none */

/*****************************************************************************
*                   C O N S T A N T S
*****************************************************************************/

/* ga request definition */
#define GA_OFF       (0)
#define GA_ON        (1)

#define M_ALERT_SILENCE 0x01

/*****************************************************************************
*                   T Y P E     D E F I N I T I O N S
*****************************************************************************/

typedef struct {
  const INT8 *p_fh_odv_cfg;
  Odv   odv_id;
  INT8  disabled;
} Ga_odv;

typedef struct {
  INT8     ga_fsm;             /* variable for finite state machine of ga */
  INT8     ga_silenced;        /* TRUE if ga off has been pressed         */
  INT8     ga_out_req;         /* requested ga output status              */
  INT8     ga_current;         /* current ga_state                        */
  INT16    c_alm;              /* alarm counter in ga table               */
  Timer    t_id_delay;         /* storage for a timer id                  */
  Timer    t_id_ga_drv;        /* storage for ga alert output driver id   */
} Ram_03668;

typedef struct {
  Ram_03668 *p_ram;            /* pointer to ram workspace                */
  ZN_ID      ga_sil_zn_id;     /* zone id of ga silenced led              */
  Mbox_cb   *p_alm_mbox_cb;    /* pointer to alarm event mailbox          */
  Mbox_cb   *p_pb_t_mbox_cb;   /* pointer to pb and timer mailbox         */
  INT8     *const *p_ga_tb;          /* pointer to the ga table                 */
  const Ga_odv    *board_odv;        /* odv_id of "on board" outputs            */
  const Ga_odv    *ext_odv;          /* odv_id of "extension board"outputs      */
  const INT8    *const *const *p_idv_cfg;        /* configuration of idv's for ga           */
  const INT8      *p_fh_ext_cfg;     /* extension card configuration            */
  const INT8      *p_fh_cfg;         /* pointer to alert silence inhibit flag   */
  const INT8      *p_fh_pa_val;      /* pointer to pre alert timer value        */
  const INT8      *p_fh_alert_val;   /* pointer to alert timer value            */
  const INT8      *p_fh_min_on_val;  /* pointer to ga minimum on timer value    */
  const INT8      *p_fh_auto_val;    /* pointer to ga auto silence timer value  */
  const INT8      *p_fh_on_val;      /* pointer to alert ga output 'on' time    */
  const INT8      *p_fh_off_val;     /* pointer to alert ga output 'off' time   */
} Rom_03668;

/*****************************************************************************
*               F U N C T I O N     D E C L A R A T I O N
*****************************************************************************/

extern void mod_03668(), init_03668();
extern INT16 ga_alm_if(),ga_output_driver(),auto_timer(),ga_pb(),ga_ev_err();
extern INT16 alm_normal(), alm_pre_alert(),alm_alert(),alm_inh(),alm_auto();
extern INT16 alm_evac(), pre_alert_timer(), alert_timer(),inhibit_timer();

#endif /* GA_H_ */
#endif
